﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TV
{
    class TV
    {
        private int currentChannel;
        List<Channel> channels = new List<Channel>();

        public TV()
        {
            channels.Add(new Channel(1, "First channel"));
            channels.Add(new Channel(2, "Second channel"));
            channels.Add(new Channel(3, "Third channel"));
        }

        public void SwitchChannelUp()
        {
            if(currentChannel == channels.Count - 1)
            {
                currentChannel = 0;
            }
            else
            {
                currentChannel++;
            }
            ShowChannelInfo();
        }

        public void SwitchChannelDown()
        {
            if (currentChannel == 0)
            {
                currentChannel = channels.Count - 1;
            }
            else
            {
                currentChannel--;
            }
            ShowChannelInfo();
        }

        public void ShowChannelInfo()
        {
            Console.WriteLine("{0} - {1}", channels[currentChannel].GetNumber, channels[currentChannel].GetName);
        }
    }
}
